package javango.forms.fields;

import java.lang.annotation.Annotation;
import java.util.Map;

import javango.forms.ValidationException;
import javango.forms.widgets.TextInputWidget;
import javango.forms.widgets.Widget;

import org.apache.commons.lang.StringUtils;

public interface Field {

	Object clean(String[] value, Map<String, String> errors) throws ValidationException;
	
	Field setName(String name);
	String getName();

	Widget getWidget();
	Field setWidget(Widget widget);
	Field setWidget(Class<? extends Widget> widgetClass);
	Class<? extends Widget> getWidgetClass();
	
	Widget getHiddenWidget();
	Field setHiddenWidget(Widget hiddenWidget);
	Field setHiddenWidget(Class<? extends Widget> widgetClass);
	Class<? extends Widget> getHiddenWidgetClass();
	
	boolean isRequired();
	Field setRequired(boolean required);

	Object getInitial();
	Field setInitial(Object initial);

	String getVerboseName();
	Field setVerboseName(String verboseName);
	
	String getHelpText();
	Field setHelpText(String helpText);	
		
	boolean isHidden();
	Field setHidden(boolean hidden);

	boolean isEditable();
	Field setEditable(boolean editable);

	boolean isAllowNull();
	Field setAllowNull(boolean allowNull);
	
	void handleAnnotation(Annotation annotation);
	
	Map<String, String> getWidgetAttrs();
}
